/*    */ package com.iris.egrant.web.struts2.tags;
/*    */ 
/*    */ import com.iris.egrant.app.utils.IrisStringUtils;
/*    */ import freemarker.template.Configuration;
/*    */ import freemarker.template.Template;
/*    */ import java.io.Writer;
/*    */ import java.util.HashMap;
/*    */ import java.util.Map;
/*    */ import javax.servlet.jsp.JspException;
/*    */ import javax.servlet.jsp.tagext.BodyTagSupport;
/*    */ import org.springframework.context.i18n.LocaleContextHolder;
/*    */ import org.springframework.web.context.WebApplicationContext;
/*    */ import org.springframework.web.context.support.WebApplicationContextUtils;
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ public class TitleTag
/*    */   extends BodyTagSupport
/*    */ {
/*    */   private static final long serialVersionUID = 1077194066541229822L;
/* 28 */   private String id = "";
/*    */   
/* 30 */   private String locale = "";
/*    */   
/* 32 */   private String title = "";
/*    */   
/* 34 */   private String className = "";
/*    */   
/*    */   public String getTitle() {
/* 37 */     return this.title;
/*    */   }
/*    */   
/*    */   public void setTitle(String title) {
/* 41 */     this.title = title;
/*    */   }
/*    */   
/*    */   public String getLocale() {
/* 45 */     if (IrisStringUtils.isNullOrBlank(this.locale)) {
/* 46 */       return LocaleContextHolder.getLocale().toString();
/*    */     }
/* 48 */     return this.locale;
/*    */   }
/*    */   
/*    */   public void setLocale(String locale) {
/* 52 */     this.locale = locale;
/*    */   }
/*    */ 
/*    */   
/*    */   public int doStartTag() throws JspException {
/* 57 */     WebApplicationContext ctx = WebApplicationContextUtils.getWebApplicationContext(this.pageContext.getServletContext());
/*    */ 
/*    */     
/* 60 */     Configuration cptFreemarkereConfiguration = (Configuration)ctx.getBean("cptFreemarkereConfiguration");
/*    */     
/*    */     try {
/* 63 */       String res = (String)this.pageContext.getAttribute("res");
/*    */       
/* 65 */       Map<String, Object> rootMap = new HashMap<String, Object>();
/* 66 */       rootMap.put("res", res);
/* 67 */       rootMap.put("id", this.id);
/* 68 */       rootMap.put("title", this.title);
/* 69 */       rootMap.put("className", this.className);
/*    */       
/* 71 */       Template template = cptFreemarkereConfiguration.getTemplate("title.ftl", "utf-8");
/* 72 */       template.process(rootMap, (Writer)this.pageContext.getOut());
/*    */     }
/* 74 */     catch (Exception e) {
/* 75 */       throw new JspException(e);
/*    */     } 
/*    */     
/* 78 */     return 0;
/*    */   }
/*    */ 
/*    */   
/*    */   public String getId() {
/* 83 */     return this.id;
/*    */   }
/*    */ 
/*    */   
/*    */   public void setId(String id) {
/* 88 */     this.id = id;
/*    */   }
/*    */   
/*    */   public String getClassName() {
/* 92 */     return this.className;
/*    */   }
/*    */   
/*    */   public void setClassName(String className) {
/* 96 */     this.className = className;
/*    */   }
/*    */ }


/* Location:              D:\文件kjt\WEB-INF\lib\egrant-core-2.2.20240205.1659.jar!\com\iris\egrant\web\struts2\tags\TitleTag.class
 * Java compiler version: 6 (50.0)
 * JD-Core Version:       1.1.3
 */